﻿using System;
using System.Collections.Generic;

namespace CardLib
{
	public class CardsList:List<Card>, ICloneable
	{
		// Add 通过List实现
		// remove 通过List实现
		// this[int index] 通过List实现
		
		public void CopyTo(Cards newCards)
		{
			for (int i = 0; i < this.Count; i++)
			{
				newCards[i] = this[i];
				//也可以用this，但是需要强制转换
				// newCards[i] = (Card)List[i];
			}
		}
		
		public object Clone()
		{	
			Cards newCards = new Cards();
			foreach (Card card in this)
			{
				newCards.Add((Card)card.Clone());
			}

			return newCards;
		}
	}
}